package com.kepler.social.app.cases;

import com.kepler.social.app.assembler.UserLoginAssembler;
import com.kepler.social.app.port.UserLoginPort;
import com.kepler.social.domain.port.vo.LoginSuccessUserInfoVo;
import com.kepler.social.domain.user.account.UserAccountAggregate;
import com.kepler.social.domain.user.account.UserAccountRepository;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class UserLoginCase implements UserLoginPort {

    @Resource
    private UserAccountRepository userAccountRepository;

    @Override
    public LoginSuccessUserInfoVo loginSuccessUserInfo(Long userId) {
        UserAccountAggregate aggregate = userAccountRepository.findByUserId(userId);
        aggregate.checkExist();
        return UserLoginAssembler.loginSuccessUserInfo(aggregate);
    }

}
